feat: add session resume support and loop resilience#17
Conversation
Add --session support to resume Claude/Codex conversations and surface resume hints from the latest session/thread IDs. Improve loop stability by continuing after agent runtime failures and non-zero exits, with per-iteration cooldown support. Harden transport handling by draining Claude background Task workers before continuation and ignoring foreign subagent events in Codex app-server responses. Tighten review signal parsing to prefer clean parsed output when transport noise is present. Extend tests across main loop behavior, Claude SDK background draining, Codex subagent filtering, and review parsing.
Summary of ChangesHello @axeldelafosse, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the robustness and usability of the agent loop runner. By introducing session resume capabilities, users can seamlessly pick up agent work where they left off, improving workflow continuity. The added loop resilience ensures that temporary agent failures or non-zero exits do not halt the entire process, making long-running tasks more stable. Furthermore, targeted improvements to both Claude SDK and Codex app-server interactions, along with smarter review parsing, contribute to a more reliable and predictable agent execution environment. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces significant enhancements, including session resume capabilities for both Claude and Codex agents via a --session flag, and improved resilience for the main execution loop. The loop now gracefully handles non-zero exit codes and runtime errors by continuing to the next iteration, and includes a configurable cooldown period. The Claude SDK server is now more robust, with logic to detect and wait for background tasks to complete before proceeding. The Codex app-server is also improved to support thread resumption and to ignore notifications from unrelated sub-agents, preventing them from failing the parent turn. The changes are well-tested, with new unit tests covering the complex new behaviors in the Claude SDK server, a regression test for the Codex app-server, and updates to existing tests to assert the new loop resilience. My feedback includes a suggestion for more robust parsing of an environment variable and another to improve code clarity with a comment.
Move iteration helpers (cooldown, session logging, tryRunAgent, formatFollowUp) from main.ts into iteration.ts to bring main.ts back under the 100-line limit. Pass sessionId as an explicit parameter to runAgent instead of mutating opts. Rename src/loop.ts to src/cli.ts to reduce confusion with the src/loop/ directory.
Summary
--session <id>and wire session/thread resume IDs through the loop runner for both Claude and CodexTransport + Review Reliability
Tasktool calls, drain background workers before continuing, and add internals for timeout/poll tuning in testsTests
tests/loop/claude-sdk-server.test.tsfor immediate completion, background drain/continue flow, non-Task behavior, and timeout behaviorValidation
bun run checkbun test